package Gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JButton;
import Gui.Dialogs.NumberOfMonthsDialog;
import Gui.Dialogs.NumberOfPlayersDialog;
import Main.Defines;

public class StartOptionsPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton m_NumberOfPlayers, m_NumberOfMonths, m_ok;
	private static StartOptionsPanel ref;

	private ActionListener getNumberOfPlayers() {
		return new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				NumberOfPlayersDialog showDialog = new NumberOfPlayersDialog();
			}
		};
	}

	private ActionListener getNumberOfMonths() {
		return new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				NumberOfMonthsDialog showDialog = new NumberOfMonthsDialog();
			}
		};
	}
	
	private ActionListener getOK_AL(){
		return new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				Defines.EVM.queueEvent("EVENT_START_GAME");
				
			}
		};
	}

	private StartOptionsPanel() {
		m_NumberOfMonths = new JButton("Set Number Of Months");
		m_NumberOfPlayers = new JButton("Set Number of Players");
		m_ok = new JButton("OK");
		
		m_NumberOfPlayers.addActionListener(getNumberOfPlayers());
		m_NumberOfMonths.addActionListener(getNumberOfMonths());
		m_ok.addActionListener(getOK_AL());
		
		
		this.add(m_NumberOfPlayers);
		this.add(m_NumberOfMonths);
		this.add(m_ok);
	}

	public static StartOptionsPanel getInstance() {
		if (ref == null)
			ref = new StartOptionsPanel();
		return ref;
	}
}
